package cn.bj.ykct.spring.boot.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import cn.bj.ykct.spring.data.test.TableOne;
import cn.bj.ykct.spring.repository.test.TableOneRepository;

@RestController
@RequestMapping("/tableOnes")
public class TableOneApi {

	@Autowired
	TableOneRepository tableOneRepo;

	@RequestMapping("/")
	public Iterable<TableOne> list() {
		return tableOneRepo.findAll();
	}

	@RequestMapping("/{id}")
	public TableOne get(@PathVariable(name = "id") long id) {
		TableOne bean = tableOneRepo.findOne(id);
		return bean;
	}
}
